package com.example.service.impl;

import com.example.common.entity.TFlowInfo;
import com.example.dao.TFlowInfoDao;
import com.example.service.TFlowInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 任务流程信息(TFlowInfo)表服务实现类
 *
 * @author 刘雨
 * @since 2024-12-08 03:05:15
 */
@Service( "tFlowInfoService" )
public class TFlowInfoServiceImpl implements TFlowInfoService {
    @Resource
    private TFlowInfoDao tFlowInfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param flowId 主键
     * @return 实例对象
     */
    @Override
    public TFlowInfo queryById(String flowId) {
        return this.tFlowInfoDao.queryById(flowId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<TFlowInfo> queryAllByLimit(int offset, int limit) {
        return this.tFlowInfoDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param tFlowInfo 实例对象
     * @return 实例对象
     */
    @Override
    public TFlowInfo insert(TFlowInfo tFlowInfo) {
        this.tFlowInfoDao.insert(tFlowInfo);
        return tFlowInfo;
    }

    /**
     * 修改数据
     *
     * @param tFlowInfo 实例对象
     * @return 实例对象
     */
    @Override
    public TFlowInfo update(TFlowInfo tFlowInfo) {
        this.tFlowInfoDao.update(tFlowInfo);
        return this.queryById(tFlowInfo.getFlowId());
    }

    /**
     * 通过主键删除数据
     *
     * @param flowId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String flowId) {
        return this.tFlowInfoDao.deleteById(flowId) > 0;
    }
}
